home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 4 / Macwelt DVD 4.cdr / Entwickler / Mac-OS / oxygen / samples / docbook / xsl / common / table.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-09  |  19.3 KB  |  544 lines  |  [□□□□/□□□□]

  1.     table.xslJŒπ¢tÚπ¢tÚÅÅIï<?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
  4.                 exclude-result-prefixes="doc"
  5.                 version="1.0">
  6.  
  7. <xsl:template name="blank.spans">
  8.   <xsl:param name="cols" select="1"/>
  9.   <xsl:if test="$cols > 0">
  10.     <xsl:text>0:</xsl:text>
  11.     <xsl:call-template name="blank.spans">
  12.       <xsl:with-param name="cols" select="$cols - 1"/>
  13.     </xsl:call-template>
  14.   </xsl:if>
  15. </xsl:template>
  16.  
  17. <xsl:template name="calculate.following.spans">
  18.   <xsl:param name="colspan" select="1"/>
  19.   <xsl:param name="spans" select="''"/>
  20.  
  21.   <xsl:choose>
  22.     <xsl:when test="$colspan > 0">
  23.       <xsl:call-template name="calculate.following.spans">
  24.         <xsl:with-param name="colspan" select="$colspan - 1"/>
  25.         <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  26.       </xsl:call-template>
  27.     </xsl:when>
  28.     <xsl:otherwise>
  29.       <xsl:value-of select="$spans"/>
  30.     </xsl:otherwise>
  31.   </xsl:choose>
  32. </xsl:template>
  33.  
  34. <xsl:template name="finaltd">
  35.   <xsl:param name="spans"/>
  36.   <xsl:param name="col" select="0"/>
  37.  
  38.   <xsl:if test="$spans != ''">
  39.     <xsl:choose>
  40.       <xsl:when test="starts-with($spans,'0:')">
  41.         <xsl:call-template name="empty.table.cell">
  42.           <xsl:with-param name="colnum" select="$col"/>
  43.         </xsl:call-template>
  44.       </xsl:when>
  45.       <xsl:otherwise></xsl:otherwise>
  46.     </xsl:choose>
  47.  
  48.     <xsl:call-template name="finaltd">
  49.       <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  50.       <xsl:with-param name="col" select="$col+1"/>
  51.     </xsl:call-template>
  52.   </xsl:if>
  53. </xsl:template>
  54.  
  55. <xsl:template name="sfinaltd">
  56.   <xsl:param name="spans"/>
  57.  
  58.   <xsl:if test="$spans != ''">
  59.     <xsl:choose>
  60.       <xsl:when test="starts-with($spans,'0:')">0:</xsl:when>
  61.       <xsl:otherwise>
  62.         <xsl:value-of select="substring-before($spans,':')-1"/>
  63.         <xsl:text>:</xsl:text>
  64.       </xsl:otherwise>
  65.     </xsl:choose>
  66.  
  67.     <xsl:call-template name="sfinaltd">
  68.       <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  69.     </xsl:call-template>
  70.   </xsl:if>
  71. </xsl:template>
  72.  
  73. <xsl:template name="entry.colnum">
  74.   <xsl:param name="entry" select="."/>
  75.  
  76.   <xsl:choose>
  77.     <xsl:when test="$entry/@spanname">
  78.       <xsl:variable name="spanname" select="$entry/@spanname"/>
  79.       <xsl:variable name="spanspec"
  80.                     select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
  81.       <xsl:variable name="colspec"
  82.                     select="$entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]"/>
  83.       <xsl:call-template name="colspec.colnum">
  84.         <xsl:with-param name="colspec" select="$colspec"/>
  85.       </xsl:call-template>
  86.     </xsl:when>
  87.     <xsl:when test="$entry/@colname">
  88.       <xsl:variable name="colname" select="$entry/@colname"/>
  89.       <xsl:variable name="colspec"
  90.                     select="$entry/ancestor::tgroup/colspec[@colname=$colname]"/>
  91.       <xsl:call-template name="colspec.colnum">
  92.         <xsl:with-param name="colspec" select="$colspec"/>
  93.       </xsl:call-template>
  94.     </xsl:when>
  95.     <xsl:when test="$entry/@namest">
  96.       <xsl:variable name="namest" select="$entry/@namest"/>
  97.       <xsl:variable name="colspec"
  98.                     select="$entry/ancestor::tgroup/colspec[@colname=$namest]"/>
  99.       <xsl:call-template name="colspec.colnum">
  100.         <xsl:with-param name="colspec" select="$colspec"/>
  101.       </xsl:call-template>
  102.     </xsl:when>
  103.     <!-- no idea, return 0 -->
  104.     <xsl:otherwise>0</xsl:otherwise>
  105.   </xsl:choose>
  106. </xsl:template>
  107.  
  108. <doc:template name="entry.colnum" xmlns="">
  109. <refpurpose>Determine the column number in which a given entry occurs</refpurpose>
  110. <refdescription>
  111. <para>If an <sgmltag>entry</sgmltag> has a
  112. <sgmltag class="attribute">colname</sgmltag> or
  113. <sgmltag class="attribute">namest</sgmltag> attribute, this template
  114. will determine the number of the column in which the entry should occur.
  115. For other <sgmltag>entry</sgmltag>s, nothing is returned.</para>
  116. </refdescription>
  117. <refparameter>
  118. <variablelist>
  119. <varlistentry><term>entry</term>
  120. <listitem>
  121. <para>The <sgmltag>entry</sgmltag>-element which is to be tested.</para>
  122. </listitem>
  123. </varlistentry>
  124. </variablelist>
  125. </refparameter>
  126.  
  127. <refreturn>
  128. <para>This template returns the column number if it can be determined,
  129. or 0 (the empty string)</para>
  130. </refreturn>
  131. </doc:template>
  132.  
  133. <xsl:template name="colspec.colnum">
  134.   <xsl:param name="colspec" select="."/>
  135.   <xsl:choose>
  136.     <xsl:when test="$colspec/@colnum">
  137.       <xsl:value-of select="$colspec/@colnum"/>
  138.     </xsl:when>
  139.     <xsl:when test="$colspec/preceding-sibling::colspec">
  140.       <xsl:variable name="prec.colspec.colnum">
  141.         <xsl:call-template name="colspec.colnum">
  142.           <xsl:with-param name="colspec"
  143.                           select="$colspec/preceding-sibling::colspec[1]"/>
  144.         </xsl:call-template>
  145.       </xsl:variable>
  146.       <xsl:value-of select="$prec.colspec.colnum + 1"/>
  147.     </xsl:when>
  148.     <xsl:otherwise>1</xsl:otherwise>
  149.   </xsl:choose>
  150. </xsl:template>
  151.  
  152. <xsl:template name="calculate.colspan">
  153.   <xsl:param name="entry" select="."/>
  154.   <xsl:variable name="spanname" select="$entry/@spanname"/>
  155.   <xsl:variable name="spanspec"
  156.                 select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
  157.  
  158.   <xsl:variable name="namest">
  159.     <xsl:choose>
  160.       <xsl:when test="@spanname">
  161.         <xsl:value-of select="$spanspec/@namest"/>
  162.       </xsl:when>
  163.       <xsl:otherwise>
  164.         <xsl:value-of select="$entry/@namest"/>
  165.       </xsl:otherwise>
  166.     </xsl:choose>
  167.   </xsl:variable>
  168.  
  169.   <xsl:variable name="nameend">
  170.     <xsl:choose>
  171.       <xsl:when test="@spanname">
  172.         <xsl:value-of select="$spanspec/@nameend"/>
  173.       </xsl:when>
  174.       <xsl:otherwise>
  175.         <xsl:value-of select="$entry/@nameend"/>
  176.       </xsl:otherwise>
  177.     </xsl:choose>
  178.   </xsl:variable>
  179.  
  180.   <xsl:variable name="scol">
  181.     <xsl:call-template name="colspec.colnum">
  182.       <xsl:with-param name="colspec"
  183.                       select="$entry/ancestor::tgroup/colspec[@colname=$namest]"/>
  184.     </xsl:call-template>
  185.   </xsl:variable>
  186.  
  187.   <xsl:variable name="ecol">
  188.     <xsl:call-template name="colspec.colnum">
  189.       <xsl:with-param name="colspec"
  190.                       select="$entry/ancestor::tgroup/colspec[@colname=$nameend]"/>
  191.     </xsl:call-template>
  192.   </xsl:variable>
  193.  
  194.   <xsl:choose>
  195.     <xsl:when test="$namest != '' and $nameend != ''">
  196.       <xsl:choose>
  197.         <xsl:when test="$ecol >= $scol">
  198.           <xsl:value-of select="$ecol - $scol + 1"/>
  199.         </xsl:when>
  200.         <xsl:otherwise>
  201.           <xsl:value-of select="$scol - $ecol + 1"/>
  202.         </xsl:otherwise>
  203.       </xsl:choose>
  204.     </xsl:when>
  205.     <xsl:otherwise>1</xsl:otherwise>
  206.   </xsl:choose>
  207. </xsl:template>
  208.  
  209. <xsl:template name="calculate.rowsep">
  210.   <xsl:param name="entry" select="."/>
  211.   <xsl:param name="colnum" select="0"/>
  212.  
  213.   <xsl:call-template name="inherited.table.attribute">
  214.     <xsl:with-param name="entry" select="$entry"/>
  215.     <xsl:with-param name="colnum" select="$colnum"/>
  216.     <xsl:with-param name="attribute" select="'rowsep'"/>
  217.   </xsl:call-template>
  218. </xsl:template>
  219.  
  220. <xsl:template name="X.calculate.rowsep">
  221.   <xsl:param name="entry" select="."/>
  222.   <xsl:param name="colnum" select="0"/>
  223.  
  224. <!--
  225.   <xsl:text>[</xsl:text>
  226.   <xsl:value-of select="$colnum"/>
  227.   <xsl:text>]</xsl:text>
  228. -->
  229.  
  230.   <xsl:choose>
  231.     <xsl:when test="$entry/ancestor::table/@frame = 'all'
  232.                     or $entry/ancestor::informaltable/@frame = 'all'">
  233.       <xsl:value-of select="1"/>
  234.     </xsl:when>
  235.     <xsl:when test="$entry/@rowsep">
  236.       <xsl:value-of select="$entry/@rowsep"/>
  237.     </xsl:when>
  238.     <xsl:when test="$entry/ancestor::row[1]/@rowsep">
  239.       <xsl:value-of select="$entry/ancestor::row[1]/@rowsep"/>
  240.     </xsl:when>
  241.     <xsl:when test="$entry/@spanname">
  242.       <xsl:variable name="spanname" select="$entry/@spanname"/>
  243.       <xsl:variable name="spanspec"
  244.                     select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
  245.       <xsl:variable name="span.colspec"
  246.                     select="$entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]"/>
  247.       <xsl:choose>
  248.         <xsl:when test="$spanspec/@rowsep">
  249.           <xsl:value-of select="$spanspec/@rowsep"/>
  250.         </xsl:when>
  251.         <xsl:when test="$span.colspec/@rowsep">
  252.           <xsl:value-of select="$span.colspec/@rowsep"/>
  253.         </xsl:when>
  254.         <xsl:otherwise>0</xsl:otherwise>
  255.       </xsl:choose>
  256.     </xsl:when>
  257.     <xsl:when test="$entry/@namest">
  258.       <xsl:variable name="namest" select="$entry/@namest"/>
  259.       <xsl:variable name="colspec"
  260.                     select="$entry/ancestor::tgroup/colspec[@colname=$namest]"/>
  261.       <xsl:choose>
  262.         <xsl:when test="$colspec/@rowsep">
  263.           <xsl:value-of select="$colspec/@rowsep"/>
  264.         </xsl:when>
  265.         <xsl:otherwise>0</xsl:otherwise>
  266.       </xsl:choose>
  267.     </xsl:when>
  268.     <xsl:when test="$colnum > 0">
  269.       <xsl:variable name="calc.rowsep">
  270.         <xsl:call-template name="colnum.colspec">
  271.           <xsl:with-param name="colnum" select="$colnum"/>
  272.           <xsl:with-param name="attribute" select="'rowsep'"/>
  273.         </xsl:call-template>
  274.       </xsl:variable>
  275.       <xsl:choose>
  276.         <xsl:when test="$calc.rowsep != ''">
  277.           <xsl:value-of select="$calc.rowsep"/>
  278.         </xsl:when>
  279.         <xsl:otherwise>0</xsl:otherwise>
  280.       </xsl:choose>
  281.     </xsl:when>
  282.     <xsl:otherwise>0</xsl:otherwise>
  283.   </xsl:choose>
  284. </xsl:template>
  285.  
  286. <xsl:template name="calculate.colsep">
  287.   <xsl:param name="entry" select="."/>
  288.   <xsl:param name="colnum" select="0"/>
  289.  
  290.   <xsl:call-template name="inherited.table.attribute">
  291.     <xsl:with-param name="entry" select="$entry"/>
  292.     <xsl:with-param name="colnum" select="$colnum"/>
  293.     <xsl:with-param name="attribute" select="'colsep'"/>
  294.   </xsl:call-template>
  295. </xsl:template>
  296.  
  297. <xsl:template name="X.calculate.colsep">
  298.   <xsl:param name="entry" select="."/>
  299.   <xsl:param name="colnum" select="0"/>
  300.  
  301. <!--
  302.   <xsl:text>[</xsl:text>
  303.   <xsl:value-of select="$colnum"/>
  304.   <xsl:text>]</xsl:text>
  305. -->
  306.  
  307.   <xsl:choose>
  308.     <xsl:when test="$entry/ancestor::table/@frame = 'all'
  309.                     or $entry/ancestor::informaltable/@frame = 'all'">
  310.       <xsl:value-of select="1"/>
  311.     </xsl:when>
  312.     <xsl:when test="$entry/@colsep">
  313.       <xsl:value-of select="$entry/@colsep"/>
  314.     </xsl:when>
  315.     <xsl:when test="$entry/ancestor::row[1]/@colsep">
  316.       <xsl:value-of select="$entry/ancestor::row[1]/@colsep"/>
  317.     </xsl:when>
  318.     <xsl:when test="$entry/@spanname">
  319.       <xsl:variable name="spanname" select="$entry/@spanname"/>
  320.       <xsl:variable name="spanspec"
  321.                     select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
  322.       <xsl:variable name="span.colspec"
  323.                     select="$entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]"/>
  324.       <xsl:choose>
  325.         <xsl:when test="$spanspec/@colsep">
  326.           <xsl:value-of select="$spanspec/@colsep"/>
  327.         </xsl:when>
  328.         <xsl:when test="$span.colspec/@colsep">
  329.           <xsl:value-of select="$span.colspec/@colsep"/>
  330.         </xsl:when>
  331.         <xsl:otherwise>0</xsl:otherwise>
  332.       </xsl:choose>
  333.     </xsl:when>
  334.     <xsl:when test="$entry/@namest">
  335.       <xsl:variable name="namest" select="$entry/@namest"/>
  336.       <xsl:variable name="colspec"
  337.                     select="$entry/ancestor::tgroup/colspec[@colname=$namest]"/>
  338.       <xsl:choose>
  339.         <xsl:when test="$colspec/@colsep">
  340.           <xsl:value-of select="$colspec/@colsep"/>
  341.         </xsl:when>
  342.         <xsl:otherwise>0</xsl:otherwise>
  343.       </xsl:choose>
  344.     </xsl:when>
  345.     <xsl:when test="$colnum > 0">
  346.       <xsl:variable name="calc.colsep">
  347.         <xsl:call-template name="colnum.colspec">
  348.           <xsl:with-param name="colnum" select="$colnum"/>
  349.           <xsl:with-param name="attribute" select="'colsep'"/>
  350.         </xsl:call-template>
  351.       </xsl:variable>
  352.       <xsl:choose>
  353.         <xsl:when test="$calc.colsep != ''">
  354.           <xsl:value-of select="$calc.colsep"/>
  355.         </xsl:when>
  356.         <xsl:otherwise>0</xsl:otherwise>
  357.       </xsl:choose>
  358.     </xsl:when>
  359.     <xsl:otherwise>0</xsl:otherwise>
  360.   </xsl:choose>
  361. </xsl:template>
  362.  
  363. <xsl:template name="inherited.table.attribute">
  364.   <xsl:param name="entry" select="."/>
  365.   <xsl:param name="colnum" select="0"/>
  366.   <xsl:param name="attribute" select="'colsep'"/>
  367.  
  368.   <xsl:variable name="entry.value">
  369.     <xsl:call-template name="get-attribute">
  370.       <xsl:with-param name="element" select="$entry"/>
  371.       <xsl:with-param name="attribute" select="$attribute"/>
  372.     </xsl:call-template>
  373.   </xsl:variable>
  374.  
  375.   <xsl:variable name="row.value">
  376.     <xsl:call-template name="get-attribute">
  377.       <xsl:with-param name="element" select="$entry/ancestor::row[1]"/>
  378.       <xsl:with-param name="attribute" select="$attribute"/>
  379.     </xsl:call-template>
  380.   </xsl:variable>
  381.  
  382.   <xsl:variable name="span.value">
  383.     <xsl:if test="$entry/@spanname">
  384.       <xsl:variable name="spanname" select="$entry/@spanname"/>
  385.       <xsl:variable name="spanspec"
  386.                     select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
  387.       <xsl:variable name="span.colspec"
  388.                     select="$entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]"/>
  389.  
  390.       <xsl:variable name="spanspec.value">
  391.         <xsl:call-template name="get-attribute">
  392.           <xsl:with-param name="element" select="$spanspec"/>
  393.           <xsl:with-param name="attribute" select="$attribute"/>
  394.         </xsl:call-template>
  395.       </xsl:variable>
  396.  
  397.       <xsl:variable name="scolspec.value">
  398.         <xsl:call-template name="get-attribute">
  399.           <xsl:with-param name="element" select="$span.colspec"/>
  400.           <xsl:with-param name="attribute" select="$attribute"/>
  401.         </xsl:call-template>
  402.       </xsl:variable>
  403.  
  404.       <xsl:choose>
  405.         <xsl:when test="$spanspec.value != ''">
  406.           <xsl:value-of select="$spanspec.value"/>
  407.         </xsl:when>
  408.         <xsl:when test="$scolspec.value != ''">
  409.           <xsl:value-of select="$scolspec.value"/>
  410.         </xsl:when>
  411.         <xsl:otherwise></xsl:otherwise>
  412.       </xsl:choose>
  413.     </xsl:if>
  414.   </xsl:variable>
  415.  
  416.   <xsl:variable name="namest.value">
  417.     <xsl:if test="$entry/@namest">
  418.       <xsl:variable name="namest" select="$entry/@namest"/>
  419.       <xsl:variable name="colspec"
  420.                     select="$entry/ancestor::tgroup/colspec[@colname=$namest]"/>
  421.  
  422.       <xsl:variable name="namest.value">
  423.         <xsl:call-template name="get-attribute">
  424.           <xsl:with-param name="element" select="$colspec"/>
  425.           <xsl:with-param name="attribute" select="$attribute"/>
  426.         </xsl:call-template>
  427.       </xsl:variable>
  428.  
  429.       <xsl:choose>
  430.         <xsl:when test="$namest.value">
  431.           <xsl:value-of select="$namest.value"/>
  432.         </xsl:when>
  433.         <xsl:otherwise></xsl:otherwise>
  434.       </xsl:choose>
  435.     </xsl:if>
  436.   </xsl:variable>
  437.  
  438.   <xsl:variable name="tgroup.value">
  439.     <xsl:call-template name="get-attribute">
  440.       <xsl:with-param name="element" select="$entry/ancestor::tgroup[1]"/>
  441.       <xsl:with-param name="attribute" select="$attribute"/>
  442.     </xsl:call-template>
  443.   </xsl:variable>
  444.  
  445.   <xsl:choose>
  446.     <xsl:when test="$entry.value != ''">
  447.       <xsl:value-of select="$entry.value"/>
  448.     </xsl:when>
  449.     <xsl:when test="$row.value != ''">
  450.       <xsl:value-of select="$row.value"/>
  451.     </xsl:when>
  452.     <xsl:when test="$span.value != ''">
  453.       <xsl:value-of select="$span.value"/>
  454.     </xsl:when>
  455.     <xsl:when test="$namest.value != ''">
  456.       <xsl:value-of select="$namest.value"/>
  457.     </xsl:when>
  458.     <xsl:when test="$colnum > 0">
  459.       <xsl:variable name="calc.colvalue">
  460.         <xsl:call-template name="colnum.colspec">
  461.           <xsl:with-param name="colnum" select="$colnum"/>
  462.           <xsl:with-param name="attribute" select="$attribute"/>
  463.         </xsl:call-template>
  464.       </xsl:variable>
  465.       <xsl:choose>
  466.         <xsl:when test="$calc.colvalue != ''">
  467.           <xsl:value-of select="$calc.colvalue"/>
  468.         </xsl:when>
  469.         <xsl:otherwise>
  470.           <xsl:value-of select="$tgroup.value"/>
  471.         </xsl:otherwise>
  472.       </xsl:choose>
  473.     </xsl:when>
  474.     <xsl:otherwise>
  475.       <xsl:value-of select="$tgroup.value"/>
  476.     </xsl:otherwise>
  477.   </xsl:choose>
  478. </xsl:template>
  479.  
  480. <xsl:template name="colnum.colspec">
  481.   <xsl:param name="colnum" select="0"/>
  482.   <xsl:param name="attribute" select="'colname'"/>
  483.   <xsl:param name="colspecs" select="ancestor::tgroup/colspec"/>
  484.   <xsl:param name="count" select="1"/>
  485.  
  486.   <xsl:choose>
  487.     <xsl:when test="not($colspecs) or $count > $colnum">
  488.       <!-- nop -->
  489.     </xsl:when>
  490.     <xsl:when test="$colspecs[1]/@colnum">
  491.       <xsl:choose>
  492.         <xsl:when test="$colspecs[1]/@colnum = $colnum">
  493.           <xsl:call-template name="get-attribute">
  494.             <xsl:with-param name="element" select="$colspecs[1]"/>
  495.             <xsl:with-param name="attribute" select="$attribute"/>
  496.           </xsl:call-template>
  497.         </xsl:when>
  498.         <xsl:otherwise>
  499.           <xsl:call-template name="colnum.colspec">
  500.             <xsl:with-param name="colnum" select="$colnum"/>
  501.             <xsl:with-param name="attribute" select="$attribute"/>
  502.             <xsl:with-param name="colspecs"
  503.                             select="$colspecs[position()>1]"/>
  504.             <xsl:with-param name="count"
  505.                             select="$colspecs[1]/@colnum+1"/>
  506.           </xsl:call-template>
  507.         </xsl:otherwise>
  508.       </xsl:choose>
  509.     </xsl:when>
  510.     <xsl:otherwise>
  511.       <xsl:choose>
  512.         <xsl:when test="$count = $colnum">
  513.           <xsl:call-template name="get-attribute">
  514.             <xsl:with-param name="element" select="$colspecs[1]"/>
  515.             <xsl:with-param name="attribute" select="$attribute"/>
  516.           </xsl:call-template>
  517.         </xsl:when>
  518.         <xsl:otherwise>
  519.           <xsl:call-template name="colnum.colspec">
  520.             <xsl:with-param name="colnum" select="$colnum"/>
  521.             <xsl:with-param name="attribute" select="$attribute"/>
  522.             <xsl:with-param name="colspecs"
  523.                             select="$colspecs[position()>1]"/>
  524.             <xsl:with-param name="count" select="$count+1"/>
  525.           </xsl:call-template>
  526.         </xsl:otherwise>
  527.       </xsl:choose>
  528.     </xsl:otherwise>
  529.   </xsl:choose>
  530. </xsl:template>
  531.  
  532. <xsl:template name="get-attribute">
  533.   <xsl:param name="element" select="."/>
  534.   <xsl:param name="attribute" select="''"/>
  535.  
  536.   <xsl:for-each select="$element/@*">
  537.     <xsl:if test="local-name(.) = $attribute">
  538.       <xsl:value-of select="."/>
  539.     </xsl:if>
  540.   </xsl:for-each>
  541. </xsl:template>
  542.  
  543. </xsl:stylesheet>
  544. This resource fork intentionally left blank   ˇˇ